<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app"></div>
  <script src="../dist/vue.js"></script>
  <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> -->
  <script>
    const vm = new Vue({
      data: {
        arr: ["海贼王", "火影忍者", { name: "名侦探柯南" }],
      },
      el: "#app",
      // 模板编译为虚拟dom的时候，从arr对象取值了 _v(_s(变量)) JSON.stringify() 
      // 所以对象会收集依赖
      template: `
        <div id="app">
            <ul>
                <li key="a">{{arr[0]}}</li>
                <li key="b">{{arr[1]}}</li>
                <li key="c">{{arr[2]["name"]}}</li>
              </ul>
          </div>
      `
    });
    setTimeout(() => {
      vm.arr[2].name += 2
    }, 1000);
  </script>
</body>

</html>